home *** CD-ROM | disk | FTP | other *** search
/ Young & Modern Digital Makeover Magic / Young & Modern Digital Makeover Magic.iso / data1.cab / TempMKV / UtilActivation.js < prev    next >
Encoding:
JavaScript  |  1999-10-18  |  14.3 KB  |  559 lines

  1. ////////////////////////////////////////////////////////////////
  2. //
  3. //    UtilActivation.js
  4. // Copyright (c) 1999 MGI Software Corp. All Rights Reserved
  5. // <Script>
  6. //
  7. //     Activation mechanisms
  8. //
  9.  
  10. //    The activation IDs are encoded using the follwing method:
  11. //    
  12. //    ID is a 32-bit int:            0x87654321
  13. //
  14. //    nibble 8:    High bit (0x80000000):     Guided mode
  15. //            rest (0x70000000):        Main module:    0- Common stuff (like print preview)
  16. //                                                    1- Photo, 2- Projects, 3- Albums,
  17. //                                                    4- Motion, 5- Internet
  18. //
  19. //    nibble 7: Toolkit in module.    1-based. 0 is default or no action
  20. //    nibble 6: Toolkit flyout.        1-based. 0 is default or no action
  21. //
  22. //    nibble 2: Bitfield corresponding to the nibbles mentionned above. If bit is set, also tell
  23. //                LTK to physically click the button
  24. //    nibble 1: Extra option bits: 0x1:    Welcome page
  25. //                                 0x2:    Skip Welcome pages unconditionally
  26.  
  27. function _ALActivate( ID )
  28. {
  29.     switch( ID & 0xF0000000 ) {                                    // Get main module
  30.     case 0x00000000:                                            // Common Stuff
  31.         switch( ID & 0x0F000000 ) {
  32.         case 0x00000000:                                    // Default module
  33.             if( ID & 0x2 )        // Skip welcome page?
  34.             { 
  35.                 ID = ID & 0xFFFFFFFE;
  36.             }
  37.             else
  38.             {
  39.                 // Should we show Welcome page?
  40.                 nShowWelcome = LTKGetIntKeyValue( "HKEY_CURRENT_USER%5CSOFTWARE%5CMGI%5CPhotoSuiteII%5C1.0%5CUserSettings", "MainWelcomePage", 1 );
  41.                 nShowWelcome = parseInt( nShowWelcome );
  42.  
  43.                 if( isNaN( nShowWelcome ) )
  44.                 {
  45.                     nShowWelcome = 1;
  46.                 }
  47.  
  48.                 if( nShowWelcome )
  49.                 {
  50.                     ID = ID | 0x1;
  51.                 }
  52.             }
  53.  
  54.             if ( ID & 0x1 )                // Welcome page?
  55.             {
  56.                 // Make sure Photos is selected and reg key is accurate
  57.                 ALClickButton(0);
  58.  
  59.                 // Set up Welcome page
  60.                 GotoWelcomeScreen();
  61.                 break;                                 // Don't go further.
  62.             }
  63.  
  64.             // Get last mode
  65.             nLastButton = LTKGetIntKeyValue( "HKEY_CURRENT_USER%5CSOFTWARE%5CMGI%5CPhotoSuiteII%5C1.0%5CUserSettings", "LastActivityListButton", 0 );
  66.             nLastButton = parseInt( nLastButton );
  67.  
  68.             if( isNaN( nLastButton ) )
  69.             {
  70.                 nLastButton = 0;
  71.             }
  72.  
  73.             // Convert to activation ID
  74.             nLastButton = (nLastButton+1) << 28;
  75.             nLastButton = nLastButton | 0x80;
  76.  
  77.             _ALActivate(nLastButton);
  78.             break;
  79.  
  80.         case 0x01000000:                                    // Print Preview
  81.             //RPASetTarget("../Common/RightPaneB2.html");
  82.             //WSetTarget("../Common/W_PrintPreview.html");
  83.             //BTSetTarget("../Common/BT_PrintPreview.html");
  84.             SetCommandBar("file:/Resources/WorkflowsComponent|Common|CommandBar.wkf,99,0");
  85.             ActivatePrintModule( ID );
  86.             break;
  87.  
  88.         case 0x02000000:                                    // Print Photo Package
  89.             switch( ID & 0x00F00000 ) {
  90.             case 0x00000000:                            // Default action
  91.             case 0x00100000:                            // Select a template
  92.                 RPASetTarget("../Common/RightPaneB2.html");
  93.                 WSetTarget("../Common/W_PrintPackage.html");
  94.                 BTSetTarget("../Common/BT_PrintPackage.html");
  95.                 BTSetVisibility( 0x01 );
  96.                 SetCommandBar("file:/Resources/WorkflowsComponent|Common|CommandBar.wkf,99,1");
  97.                 break;
  98.  
  99.             case 0x00200000:
  100.                 RPASetTarget("../Common/RightPaneB2.html");
  101.                 WSetTarget("../Common/W_PrintPackagePreview.html");
  102.                 BTSetTarget("../Common/BT_PrintPreview.html");
  103.                 SetCommandBar("file:/Resources/WorkflowsComponent|Common|CommandBar.wkf,99,0");
  104.                 break;
  105.  
  106.             }
  107.             break;
  108.  
  109.         case 0x03000000:                                    // Send to PhotoNet
  110.             RPASetTarget("../Common/RightPaneA2.html");
  111.             WSetTarget("../Common/W_SendPhotoNet.html");
  112.             BTSetTarget("../Common/BTSendPhotoNet.html");
  113.             SetCommandBar("file:/Resources/WorkflowsComponent|Common|CommandBar.wkf,99,1");
  114.             break;
  115.  
  116.         case 0x0F000000:                                    // About pages
  117.             showModalDialog("../Common/About.html", null, "dialogWidth:350px;dialogHeight:505px;help:no");
  118.             break;
  119.         }
  120.         break;
  121.  
  122.     case 0x10000000:                                            // Photo Module
  123.         if( ID & 0x00000080 )        // Click the button?
  124.         {
  125.             _ALClickButton(0);
  126.         }
  127.         
  128.         if ( ID & 0x1 )                // Welcome page?
  129.         {
  130.             // Set up Welcome page
  131.             GotoWelcomeScreen();
  132.             break;                                 // Don't go further.
  133.         }
  134.  
  135.         if( ( ID & 0x0F000000 ) != 0x01000000 )            // Anything but Get Photos
  136.         {
  137.             Context = LTKGetContext( 1 );
  138. top.debugalert("ActivatePhoto Context: "+Context);
  139.             if( Context == -1 )                // Error, can't jump
  140.             {
  141.                 return;
  142.             }
  143.  
  144.             if( Context == 0 )                // No photo available
  145.             {
  146.                 // Call Wecome Page
  147.                 _ALActivate( ID | 0x1 );
  148.                 SetCommandBar("file:/Resources/WorkflowsComponent|Photos|T_Paint.wkf,50,1;file:/Resources/WorkflowsComponent|Photos|CommandBar.wkf,99,1");
  149.                 break;
  150.             }
  151.         }
  152.  
  153.         // Sub
  154. //        ActivatePhotoModule( ID );
  155.  
  156.         break;
  157.  
  158.     case 0x20000000:                                            // Projects Module
  159.         if( ID & 0x00000080 )        // Click the button?
  160.         {
  161.             _ALClickButton(1);
  162.         }
  163.  
  164.         if ( ID & 0x1 )                // Welcome page?
  165.         {
  166.             // Set up Welcome page
  167.             GotoWelcomeScreen();
  168.             break;                                 // Don't go further.
  169.         }
  170.  
  171.         // Sub
  172.         
  173.         Context = LTKGetContext( 2 );
  174.         if( Context == -1 )                // Error, can't jump
  175.         {
  176.             return;
  177.         }
  178.  
  179.         if( Context == 0 )                // No photo available
  180.         {
  181.             // Call Wecome Page
  182.             _ALActivate( ID | 0x1 );
  183.             break;
  184.         }
  185.  
  186.         RouteCall("WorkArea", "TClickButton(-2);" );
  187.         SetCommandBar("file:/Resources/WorkflowsComponent|Publish|T_Publish.wkf,50,1;file:/Resources/WorkflowsComponent|Publish|CommandBar.wkf,99,1");
  188.         ActivateLayoutModule( ID );
  189.         break;
  190.  
  191.     case 0x30000000:                                            // Album Module
  192.         if( ID & 0x00000080 )        // Click the button?
  193.         {
  194.             _ALClickButton(2);
  195.         }
  196.         Context = LTKGetContext( 4 );
  197. //top.debugalert("Click Context: "+Context+" ID:"+ID );
  198.         if( Context == -1 )                // Error, can't jump
  199.         {
  200.             return;
  201.         }
  202.  
  203.         if( Context == 0 )                // No album available
  204.         {
  205.             // Call Welcome Page
  206.             //ID = ( ID | 0x1 );
  207.             //nope call Master Album
  208.             ID = ( ID | 0x2000000 );
  209.             ActivateMasterAlbum(ID);
  210.             break;
  211.         }
  212.  
  213.         if ( ID & 0x1 )                // Welcome page?
  214.         {
  215.             // Set up Welcome page
  216.             GotoWelcomeScreen();
  217.             break;                                 // Don't go further.
  218.         }
  219.  
  220.         // Sub
  221.         top.debugalert("Activate Album");
  222.         ActivateAlbumModule( ID );
  223.         break;
  224.  
  225.     case 0x40000000:                                            // Slide Show Module
  226.         if( ID & 0x00000080 )        // Click the button?
  227.         {
  228.             _ALClickButton(3);
  229.         }
  230.  
  231.         Context = LTKGetContext( 3 );
  232.         if( Context == -1 )                // Error, can't jump
  233.         {
  234.             return;
  235.         }
  236.  
  237.         if( Context == 0 )                // No slideshow available
  238.         {
  239.             // Call Wecome Page
  240.             ID = ( ID | 0x1 );
  241.         }
  242.  
  243.         if ( ID & 0x1 )                // Welcome page?
  244.         {
  245.             // Set up Welcome page
  246.             RPASetTarget('../Motion/RightPaneA3.html');
  247.             WSetTarget( "../Motion/W_Welcome.html" );
  248.             RouteCall("WorkArea", "_WSetVisibility();");
  249.  
  250.             break;                                 // Don't go further.
  251.         }
  252.  
  253.         switch( ID & 0x00F00000 ) {
  254.         case 0x00500000:                                    // Print PhotoPackage
  255.             _ALActivate(0x02000000);
  256.             break;
  257.  
  258.         case 0x00600000:                                    // Send to PhotoNet
  259.             _ALActivate(0x03000000);
  260.             break;
  261.  
  262.         default:
  263.             RPASetTarget('../Motion/RightPaneA.html');
  264.             WSetTarget('../Motion/W_Motion.html');
  265.             BTSetTarget("../Motion/BuddyTools.html");
  266.             RouteCall("WorkArea", "RouteCall('BuddyTools', 'LTKTriggerEvent(\"file:/Resources/WorkflowsComponent|Motion|PM_Tools.wkf,1,1138\");' )" );
  267.         }
  268.  
  269.         break;
  270.  
  271.     case 0x50000000:                                            // Internet Module
  272.         if( ID & 0x00000080 )        // Click the button?
  273.         {
  274.             _ALClickButton(4);
  275.         }
  276.  
  277.         switch( ID & 0x0F000000 ) {
  278.         case 0x00000000:            // Default behavior
  279.             RPASetTarget('../Internet/RightPaneA3.html' );
  280.             WSetTarget("../Internet/W_Internet.html");
  281.             break;
  282.  
  283.         case 0x01000000:            // Directly to browser
  284.             RPASetTarget('../Internet/RightPaneA3.html' );
  285.             WSetTarget("../Internet/W_Internet.html");
  286.             break;
  287.         }
  288.         break;
  289.  
  290.     case 0x60000000:                                        // Guides
  291.         if( ID & 0x00000080 )        // Click the button?
  292.         {
  293.             _ALClickButton(5);
  294.         }
  295.         
  296.         ActivateGuides(ID);
  297.  
  298.         break;
  299.         
  300.     default:
  301.         // Unknown!
  302.         alert( "Unknown Activation ID!" );
  303.     }
  304. }
  305.  
  306.  
  307. ////////////////////////////////////////////////////////////////
  308. //
  309. //    Sub functions
  310. //
  311.  
  312. function ActivatePhoto( ID )
  313. {
  314.     if( ID & 0x00000040 )                // Click the button?
  315.     {
  316.         TKClickButton((ID >> 28) & 0xF);
  317.     }
  318.  
  319.     switch( ID & 0xF000000 ) {
  320.     case 0x0000000:                        // Default
  321.         _ALActivate( 0x12000040 );
  322.         break;
  323.  
  324.     case 0x1000000:                        // Get Photo
  325.         switch( ID & 0xF00000 ) {
  326.         case 0x100000:                // From Computer
  327.             LTKTriggerEvent("CommandDispatcher,Active,20001");
  328.             break;
  329.  
  330.         case 0x200000:                // From Album
  331.             switch( ID & 0xF0000 ) {
  332.             case 0x00000:
  333.             case 0x10000:
  334.                 LTKTriggerEvent("CommandDispatcher,Active,20015");
  335.                 break;
  336.  
  337.             case 0x20000:
  338.                 RPASetTarget("../Photos/RightPaneA2.html");
  339.                 WSetTarget("../Photos/W_GetAlbum.html");
  340.                 BTSetTarget("../Photos/BTGetAlbum.html");
  341.                 SetCommandBar("file:/Resources/WorkflowsComponent|Photos|CommandBar.wkf,99,3");
  342.                 break;
  343.             }
  344.             break;
  345.  
  346.         case 0x300000:                // From Camera
  347.             switch( ID & 0xF0000 ) {
  348.             case 0x00000:
  349.             case 0x10000:
  350.                 ActivateCameraModule();
  351.                 BTSetTarget('../Photos/BTGetCamera.html');
  352.                 WSetTarget('../Photos/W_GetCamera.html');
  353.                 break;
  354.  
  355.             case 0x20000:
  356.                 // Get currently selected camera
  357.                 sCamera = LTKGetKeyValue( "HKEY_LOCAL_MACHINE%5CSOFTWARE%5CMGI%5CPhotoSuiteII%5C1.0%5CLiquid Toolkit%5CPreferences", "CurrentCameraKey", "" );
  358.                 if(sCamera)
  359.                 {
  360.                     sFile = LTKGetKeyValue( "HKEY_LOCAL_MACHINE%5CSOFTWARE%5CMGI%5CPhotoSuiteII%5C1.0%5CLiquid Toolkit%5CInput Device Configs%5C"+sCamera, "ControlCameraPage", "" );
  361.  
  362.                     if(sFile)
  363.                     {
  364.                         BTSetTarget("../Photos/CameraCtrl/"+sFile);
  365.                     }
  366.                 }
  367.                 break;
  368.             }
  369.             break;
  370.  
  371.         case 0x400000:                // From Twain
  372.             switch( ID & 0xF0000 ) {
  373.             case 0x00000:
  374.             case 0x10000:
  375.                 RPASetTarget('../Photos/RightPaneA2.html');
  376.                 BTSetTarget('../Photos/BTGetTwain.html');
  377.                 WSetTarget('../Common/W_Empty.html');
  378.                 break;
  379.  
  380.             case 0x20000:
  381.                 WSetTarget('../Photos/W_GetTwain.html');
  382.                 break;
  383.             }
  384.             break;
  385.  
  386.         case 0x500000:                // From PhotoNet
  387.             RPASetTarget('../Photos/RightPaneA2.html');
  388.             BTSetTarget('../Photos/BTGetPhotoNet.html');
  389.             WSetTarget('../Photos/W_GetPhotoNet.html');
  390.             break;
  391.         
  392.         case 0x600000:                // New
  393.             LTKTriggerEvent("CommandDispatcher,Active,20020");
  394.             break;
  395.  
  396.         }
  397.         break;
  398.  
  399.     case 0x2000000:                        // Edit
  400.         RPASetTarget('../Photos/RightPaneA.html');
  401.         BTSetTarget('../Photos/BuddyTools.html');
  402.         WSetTarget('../Photos/W_Paint.html');
  403.         RouteCall("WorkArea", "RouteCall('Tools', 'BTSetPaintMode(-1);');" );
  404.         RouteCall("WorkArea", "TClickButton(-1);" );
  405.         break;
  406.  
  407.     case 0x3000000:                        // Size and rotate
  408.         RPASetTarget('../Photos/RightPaneA.html');
  409.         BTSetTarget('../Photos/BuddyTools.html');
  410.         WSetTarget('../Photos/W_Paint.html');
  411.         // Zoom to fit when W_Paint is loaded
  412.         RouteCall("WorkArea", "LTKTriggerEvent('CommandDispatcher,BroadcastCommand,20063');" );
  413.         RouteCall("WorkArea", "TClickButton(2);" );
  414.         break;
  415.  
  416.     case 0x4000000:                        // Touchup/effects
  417.         switch( ID & 0xF00000 ) {
  418.         case 0x100000:                // Touchups
  419.             RPASetTarget('../Photos/RightPaneA.html');
  420.             BTSetTarget('../Photos/BTSpecialFx.html');
  421.             WSetTarget('../Photos/W_SpecialFx.html');
  422.             BTSetVisibility(0x2000);
  423.             RouteCall("WorkArea", "TClickButton(-1);" );
  424.             break;
  425.  
  426.         case 0x200000:                // Special Fx
  427.             RPASetTarget('../Photos/RightPaneA.html');
  428.             BTSetTarget('../Photos/BTSpecialFx.html');
  429.             WSetTarget('../Photos/W_SpecialFx.html');
  430.             BTSetVisibility(0x2020);
  431.             RouteCall("WorkArea", "TClickButton(-1);" );
  432.             break;
  433.             
  434.         case 0x300000:                // Warps
  435.             RPASetTarget("../Photos/RightPaneA.html");
  436.             WSetTarget("../Photos/W_Warp.html");
  437.             BTSetTarget("../Photos/BTWarp.html");
  438.             RouteCall("WorkArea", "TClickButton(-1);" );
  439.             break;
  440.  
  441.         case 0x400000:                // Remove Red Eye
  442.             RPASetTarget('../Photos/RightPaneA.html');
  443.             BTSetTarget('../Photos/BuddyTools.html');
  444.             WSetTarget('../Photos/W_Paint.html');
  445.             RouteCall("WorkArea", "RouteCall('Tools', 'BTSetPaintMode(6);');" );
  446.             RouteCall("WorkArea", "TClickButton(7);" );
  447.             TKClickButton(0x10000001);        // **Change Value to ** Show edit toolkit button again.
  448.             break;
  449.         }
  450.         break;
  451.  
  452.     case 0x5000000:                        // Save and Print
  453.         switch( ID & 0xF00000 ) {
  454.         case 0x400000:                // Print Preview
  455.             _ALActivate( 0x01000000 );
  456.             break;
  457.  
  458.         case 0x500000:                // Print Photo Package
  459.             _ALActivate( 0x02000000 );
  460.             break;
  461.  
  462.         case 0x800000:                // Send to PhotoNet
  463.             _ALActivate( 0x03000000 );
  464.             break;
  465.  
  466.         }
  467.         break;
  468.  
  469.     default:
  470.         alert( "Unknown Activation ID!" );
  471.     }
  472. }
  473.  
  474. function ActivateProjects( ID )
  475. {
  476.     if( ID & 0x00000040 )                // Click the button?
  477.     {
  478.         TKClickButton( ((ID >> 28) & 0xF) - 1 );
  479.     }
  480.  
  481. //    Note: Those IDs are a little different. The toolkit is not enumerated
  482. //    like for other modules. Rather, it is divided in categories, independant
  483. //    of the toolkit organization.
  484.  
  485.     switch( ID & 0xF000000 ) {
  486.     case 0x0000000:                        // Default
  487.         Context = LTKGetContext( 2 );
  488.         if( Context == -1 )                // Error, can't jump
  489.         {
  490.             return;
  491.         }
  492.  
  493.         if( Context == 0 )                // No photo available
  494.         {
  495.             // Call Wecome Page
  496.             _ALActivate( ID | 0x1 );
  497.             break;
  498.         }
  499.  
  500.         RPASetTarget('../Publish/RightPaneA.html');
  501.         BTSetTarget("../Publish/BuddyTools.html");
  502.         WSetTarget("../Publish/W_Publish.html");
  503.         RouteCall("WorkArea", "TClickButton(-2);" );
  504.         SetCommandBar("file:/Resources/WorkflowsComponent|Publish|T_Publish.wkf,50,1;file:/Resources/WorkflowsComponent|Publish|CommandBar.wkf,99,1");
  505.         break;
  506.  
  507.  
  508.     case 0x3000000:                        // Save and print
  509.         switch( ID & 0xF00000 ) {
  510.         case 0x400000:                // Print Preview
  511.             _ALActivate( 0x01000000 );
  512.             break;
  513.  
  514.         case 0x500000:                // Print photo package
  515.             _ALActivate(0x02000000);
  516.             break;
  517.  
  518.         case 0x800000:                // Send to PhotoNet
  519.             _ALActivate(0x03000000);
  520.             break;
  521.  
  522.         }
  523.         break;
  524.     }
  525. }
  526.  
  527.  
  528. function ActivateAlbums( ID )
  529. {
  530.     if( ID & 0x00000040 )                // Click the button?
  531.     {
  532.         TKClickButton( ((ID >> 28) & 0xF) - 1 );
  533.     }
  534.  
  535.     switch( ID & 0xF000000 ) {
  536.     case 0x0000000:                        // Default
  537.         RPASetTarget("../Album/RightPaneA.html");
  538.         WSetTarget("../Album/W_Album.html");
  539.         BTSetTarget("../Album/BuddyTools.html");
  540.         break;
  541.  
  542.     case 0x1000000:                        // Get/Share
  543.         switch( ID & 0xF00000 ) {
  544.         case 0x300000:                // Print photo package
  545.             _ALActivate(0x02000000);
  546.             break;
  547.  
  548.         case 0x500000:                // Send to PhotoNet
  549.             _ALActivate(0x03000000);
  550.             break;
  551.         }
  552.         break;
  553.  
  554.     case 0x2000000:                        // Master Album
  555.         ActivateMasterAlbum(ID);
  556.         break;
  557.  
  558.     }
  559. }